<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title>${title}</title>
		<meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/am.reference.ftl" />
	</head>
	<body class="${configs["skinName"]}">
		<div class="page-content">
			<div class="row">
			<#if viewMode !="view">
			<#include "common/breadcrumb.ftl">
			</#if>
				<form id="form" role="form" class="form-horizontal" method="post" action="${base}/${form_action}"  enctype="multipart/form-data">
					<div class="col-xs-12">
						<div class="widget-box">
							<div class="widget-body">
								<input type="hidden" name="orderNo" id="orderNo" value="${model.orderNo}" <#if viewMode == "view">disabled</#if>>
								<#if viewMode == "view">
								<div class="widget-header widget-header-flat">
									<h5 class="lighter">
										${module}
									</h5>
								</div>
								<#else>
								<div class="alert alert-warning">
									<strong>提示!</strong>
									<strong style="color:#dd514c;">出现红框</strong>的表示不能为空
								</div>
								</#if>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										发布者
									</label>
									<div class="col-sm-6">
										<input type="text" id="publisher" name="publisher" value="<#if model.linkUser>${model.linkUser.phoneNo}<#else>${model.publisher}</#if>" class="form-control" required placeholder="请输入手机号" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										货物名称
									</label>
									<div class="col-sm-6">
										<input type="text" id="goodsName" name="goodsName" value="${model.goodsName}" class="form-control" required placeholder="请输入身份证号" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										货物重量
									</label>
									<div class="col-sm-6 input-group">
										<input type="text" id="googsWeight" name="googsWeight" value="${model.googsWeight}" class="form-control" required placeholder="请输入真实姓名" <#if viewMode == "view">disabled</#if>>
										<span class="input-group-addon">公斤</span>
									</div>
								</div>
								<#if viewMode == 'view'>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										货物图片
									</label>
								<#if model.images?exists && model.images?size gt 0>
								<div class="col-sm-6 row">
								<#list model.images as item>
									<div class="col-sm-3">
										<img src="${item.image}" height="50">
									</div>
								</#list>
								</div>
								</#if>
								</div>
								<#else>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										物品图片1
									</label>
									<div class="col-sm-6">
										<input type="file" name="files" value="" class="form-control">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										物品图片2
									</label>
									<div class="col-sm-6">
										<input type="file" name="files" value="" class="form-control">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										物品图片3
									</label>
									<div class="col-sm-6">
										<input type="file" name="files" value="" class="form-control">
									</div>
								</div>
								</#if>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										状态
									</label>
									<div class="col-sm-6">
										<select id="status" name="status" class="chosen-select form-control" <#if viewMode == "view">disabled</#if>>
											<option value="1" <#if model.status == 1 >selected="selected"</#if> >发布</option>
											<option value="2" <#if model.status == 2 >selected="selected"</#if> >接单</option>
											<option value="4" <#if model.status == 4 >selected="selected"</#if> >拒单</option>
											<option value="8" <#if model.status == 8 >selected="selected"</#if> >配送</option>
											<option value="16" <#if model.status == 16 >selected="selected"</#if> >完成</option>
										</select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										收货人
									</label>
									<div class="col-sm-6">
										<input type="text" id="receiver" name="receiver" value="${model.receiver}" class="form-control" required placeholder="请输入收货人" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										收货人电话
									</label>
									<div class="col-sm-6">
										<input type="text" id="receivePhone" name="receivePhone" value="${model.receivePhone}" class="form-control" required placeholder="请输入收货人电话" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										收货地址
									</label>
									<div class="col-sm-6">
										<input type="text" id="receiveAddress" name="receiveAddress" value="${model.receiveAddress}" class="form-control" required placeholder="请输入收货地址" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										配送人
									</label>
									<div class="col-sm-6">
										<input type="text" id="deliveryPerson" name="deliveryPerson" value="${model.deliveryPerson}" class="form-control" required placeholder="请输入配送人" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										配送人电话
									</label>
									<div class="col-sm-6">
										<input type="text" id="deliveryPhone" name="deliveryPhone" value="${model.deliveryPhone}" class="form-control" required placeholder="请输入配送人电话" <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										发布时间
									</label>
									<div class="col-sm-6">
										<input type="text" id="txtCreateTime" name="txtCreateTime" value="<#if model.createTime gt 0>${(model.createTime * 1000) ?number_to_date}</#if>" class="form-control" required  <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										配送时间
									</label>
									<div class="col-sm-6">
										<input type="text" id="txtDeliveryTime" name="txtDeliveryTime" value="<#if model.deliveryTime gt 0>${(model.deliveryTime * 1000) ?number_to_date}</#if>" class="form-control" required  <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										完成时间
									</label>
									<div class="col-sm-6">
										<input type="text" id="txtCompleteTime" name="txtCompleteTime" value="<#if model.completeTime gt 0>${(model.completeTime * 1000) ?number_to_date}</#if>" class="form-control" required  <#if viewMode == "view">disabled</#if>>
									</div>
								</div>
								<#if viewMode != "view">
								<div class="clearfix form-actions">
									<div class="col-md-offset-3 col-md-9">
										<button id="btnSubmit" class="btn btn-info" type="submit">
											<i class="fa fa-check bigger-110"></i>
											提 交
										</button>
									</div>
								</div>
								</#if>
							</div>
						</div>
					</div>
				</form>
			</div>	
		</div>
		<script type="text/javascript">
		$(function(){
			$('input[type="file"]').ace_file_input(imageParms).on('change',function(){
				var fileId = $(this).attr('id');
				var inputid = $(this).attr('data-input');
				var previewId = $(this).attr('data-image');
				openLoading();
				$.ajaxFileUpload({
		                url: '${base}/upload/image', 
		                type:'POST',
		                data:{module:'driver',hasRoot:true},          
		                secureuri: false,
		                fileElementId: fileId,                   //文件选择框的id属性
		                dataType: 'json',                       
		                success: function (rst){
		                    if(rst.status == 'OK' && rst.link != ''){
			                    $('#'+previewId).attr('src',rst.link).show();
		                    	$('#'+inputid).val(rst.link);
		                    }
		                    else{
		                    	layer.alert(rst.message);
		                    }
		                },
		                error: function (data, status, e) {
		                    layer.alert('上传图片失败');
		                },
		                complete:function(){
		                	closeLoading();
		                }
		          });
			});
			$('.chosen-select').chosen();
			$('#form').validator();
		})
		</script>
	</body>
</html>